package com.hc.core.util.pageStatic;

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;

import java.util.Timer;

public class IndexToHtmlListener
    extends HttpServlet implements ServletContextListener{
    Timer timer = null;
    ServletContext request = null;
    //Notification that the web module is ready to process requests
    public void contextInitialized(ServletContextEvent contextEvent) {
        timer  = new Timer(true);
        System.out.println("定时器启动!");
        timer.schedule(new IndexToHtmlTask(contextEvent.getServletContext()), 0, 60*60*1000);
        System.out.println("首页静态化1小时刷新任务已添加到调度表!");
    }

    //Notification that the servlet context is about to be shut down
    public void contextDestroyed(ServletContextEvent sce) {
        System.out.println("定时器销毁!");
    }
}